import request from '@/utils/request'

export function templateList(query) {
  return request({
    url: '/template/list',
    method: 'get',
    params: query
  })
}

export function fetchTemplate(id) {
  return request({
    url: '/template/detail/' + id,
    method: 'get'
  })
}

export function updateTemplate(id, data) {
  return request({
    url: '/template/update/' + id,
    method: 'put',
    data
  })
}

export function addTemplate(data) {
  return request({
    url: '/template/add',
    method: 'post',
    data
  })
}

export function deleteTemplate(id) {
  return request({
    url: `/template/delete/${id}`,
    method: 'delete'
  })
}

export function nameCheck(nameKey) {
  return request({
    url: '/template/name/check/' + nameKey,
    method: 'get'
  })
}
